from Base import message, intersect, SS_VALID
from DRG import MDCC_DRG

def group(record):
  adrg_zd = []
  adrg_zd1 = []
  adrg_ss = ["12.8703","12.8801","14.0100","14.0101","14.0200x001","14.0200x002","14.0201","14.0202","14.2101","14.2102","14.2201","14.2202","14.2301","14.2302","14.2401","14.2402","14.2403","14.2500","14.2601","14.2602","14.2900x001","14.2900x002","14.2900x003","14.2900x004","14.2901","14.2902","14.3101","14.3200x001","14.3200x002","14.3300","14.3400","14.3500","14.3901","14.4100","14.4900x001","14.4901","14.4902","14.4903","14.5101","14.5200x001","14.5300x001","14.5400x001","14.5500","14.5901","14.5902","14.5903","14.5904","14.5905","14.6x00x001","14.6x01","14.6x02","14.7100x001","14.7201","14.7300x001","14.7401","14.7500x001","14.7500x002","14.7500x003","14.7500x004","14.7501","14.7900x001","14.7901","14.7902","14.7903","14.7904","14.7905","14.9x00x001","14.9x01","14.9x02","14.9x03","14.9x04","14.9x05","14.9x06","14.9x07","14.9x08","16.9100x002"]
  adrg_ss1 = ["13.0100","13.0201","13.1100","13.1900x006","13.1900x007","13.1900x008","13.1901","13.1902","13.2x01","13.3x00x001","13.3x01","13.4100x001","13.4101","13.4200x001","13.4300x001","13.5100","13.5900x001","13.6400x001","13.6500x002","13.6501","13.6502","13.6503","13.6600","13.6900x002","13.6901","13.7000","13.7100x001","13.7200x001","13.8x00x003","13.9000x004","13.9000x005","13.9000x006","13.9000x007","13.9000x008","13.9000x009","13.9000x010","13.9000x011","13.9001","13.9002","13.9003","13.9100x001"]
  dept_list = []

  if True and record.ssList and intersect(record.ssList,adrg_ss) and intersect(record.ssList,adrg_ss1):
    message('符合CB2入组条件，匹配规则：双手术匹配')

    if MDCC_DRG.CB29_group(record):
      return 'CB29'
        
    return 'CB2'
  else:
    return ''
    
